<template>
  <div>
    <!-- 面包屑导航 -->
    <bread :item="['权限管理','权限列表']"></bread>
    <!-- 卡片视图 -->
    <el-card shadow="hover">
      <el-table :data="rights" border stripe height="580">
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <template slot-scope="sope">
            <el-tag v-if="sope.row.level==='0'">一级</el-tag>
            <el-tag v-else-if="sope.row.level==='1'" type="success">二级</el-tag>
            <el-tag v-else type="warning">三级</el-tag>
          </template>
        </el-table-column>

      </el-table>
    </el-card>
  </div>
</template>

<script>
import {bread} from "tools"
export default {
  components:{bread}
 ,data(){return{
    //权限列表数据
    rights:[]
  }}
 ,created(){
   //初始获取数据
   this.getRights()
 }
 ,methods:{
  async getRights(){
     let {data:ret}= await this.$XHR.get('rights/list')
     //错误提示
     if(ret?.meta?.status !==200)return this.$message({
         type:"error"
        ,message:"获取权限失败"
        ,center:"center"})
     //存储数据
     this.rights= ret?.data ? ret?.data : []

   }
 }
}
</script>
<style lang="less" scoped>

</style>